package com.abcode.test.springbootmybatisplus.gen.service.impl;

import com.abcode.test.springbootmybatisplus.gen.entity.UserDetailsInfo;
import com.abcode.test.springbootmybatisplus.gen.mapper.UserDetailsInfoMapper;
import com.abcode.test.springbootmybatisplus.gen.param.UserDetailsInfoParam;
import com.abcode.test.springbootmybatisplus.gen.service.UserDetailsInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 德州扑克用户详细信息表(UserDetailsInfo)表服务实现类
 *
 * @author abcode
 * @since 2025-06-27 23:27:19
 */
@Service
public class UserDetailsInfoServiceImpl extends ServiceImpl<UserDetailsInfoMapper, UserDetailsInfo> implements UserDetailsInfoService {
    @Override
    public IPage pageQuery(UserDetailsInfoParam param) {
        UserDetailsInfo userDetailsInfo = param.toEntity();
        Page page = new Page();
        LambdaQueryWrapper<UserDetailsInfo> queryWrapper = new LambdaQueryWrapper<>(userDetailsInfo);
        return page(page, queryWrapper);
    }

    @Override
    public boolean add(UserDetailsInfoParam param) {
        UserDetailsInfo userDetailsInfo = param.toEntity();
        return save(userDetailsInfo);
    }

    @Override
    public boolean edit(UserDetailsInfoParam param) {
        UserDetailsInfo userDetailsInfo = param.toEntity();
        return updateById(userDetailsInfo);
    }

    @Override
    public List<UserDetailsInfo> listQuery(UserDetailsInfoParam param) {
        UserDetailsInfo userDetailsInfo = param.toEntity();
        LambdaQueryWrapper<UserDetailsInfo> queryWrapper = new LambdaQueryWrapper<>(userDetailsInfo);
        return list(queryWrapper);
    }
}

